﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AutoUpdate.Model.Packet
{
    public class Packet
    {
        //封包的走向
        public string Topic { set; get; } = string.Empty;//Function topic

        public string PacketID { set; get; } = string.Empty;//GUID

        public string CommandText { set; get; } = string.Empty;

        public string MessageContent { set; get; } = string.Empty;

        public int clientSessionID { set; get; } = 0;

        public long MessageTime { set; get; } = 0;

        public PacketType PacketType { set; get; } = PacketType.Request;

        public Packet()
        {
            this.PacketID = Guid.NewGuid().ToString();

            //this.MessageTime = DateTime.Now.ToFileTimeUtc();
        }

        public void FillData( Packet packet)
        {

            packet.clientSessionID = this.clientSessionID;

            packet.CommandText = this.CommandText;

            packet.MessageContent = this.MessageContent;

            packet.MessageTime = this.MessageTime;

            packet.PacketID = this.PacketID;

            packet.PacketType = this.PacketType;

            packet.Topic = this.Topic;

        }
    }
}
